package com.adcc.loadsheet.billing.vo;

import com.adcc.loadsheet.billing.entity.PbDepartmentEntity;
import com.adcc.loadsheet.billing.entity.PbStaffEntity;
import com.google.common.base.Strings;

/**
 * 用户tree
 * Created by zhaoml on 2020/4/15.
 */
public class PbStaffTreeVO {
    //节点ID
    private String id;
    //父节点ID
    private String pId;
    //节点名称
    private String name;
    //节点是否打开
    private Boolean open;
    //节点是否选中
    private Boolean checked;
    //是否是父节点(默认传null即可)
    private Boolean isParent;
    //图标
    private String icon;

    //用户节点
    public PbStaffTreeVO(PbStaffEntity staffEntity, Boolean open){
        this.id = staffEntity.getPB_LOGIN_ID();
        this.pId = staffEntity.getPB_DEPARTMENT_ID();
        this.isParent = false;
        this.name = staffEntity.getPB_NAME();
        this.open = open;
        this.icon = "/zTree/img/diy/user1.png";
    }

    //部门节点
    public PbStaffTreeVO(PbDepartmentEntity departmentEntity, Boolean open){
        this.id = departmentEntity.getPB_ID();
        this.pId = Strings.isNullOrEmpty(departmentEntity.getPB_PARENT_ID()) ? "0" : departmentEntity.getPB_PARENT_ID();
        this.isParent = true;
        this.name = departmentEntity.getPB_NAME();
        this.open = open;
//        this.icon = "/zTree/img/diy/5.png";
    }

    //根节点
    public PbStaffTreeVO(String id, String pId, String name, Boolean open){
        this.id = id;
        this.pId = pId;
        this.name = name;
        this.open = open;
        this.isParent = true;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getOpen() {
        return open;
    }

    public void setOpen(Boolean open) {
        this.open = open;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public Boolean getIsParent() {
        return isParent;
    }

    public void setIsParent(Boolean isParent) {
        this.isParent = isParent;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }
}